home *** CD-ROM | disk | FTP | other *** search
/ VRML 2.0 Sourcebook (2nd Edition) / VRML 2.0 Sourcebook CD [md5 fed90f4f9c39d5a60d477058775c7e21].iso / book / win / ch13 / 13fig17.wrl < prev    next >
Text File  |  1996-09-23  |  2KB  |  75 lines

  1. #VRML V2.0 utf8
  2. # The VRML 2.0 Sourcebook
  3. # Copyright [1997] By
  4. # Andrea L. Ames, David R. Nadeau, and John L. Moreland
  5. Group {
  6.     children [
  7.     # Morphing shape
  8.         Shape {
  9.             appearance Appearance {
  10.                 material Material {
  11.                     diffuseColor 0.0 1.0 1.0
  12.                 }
  13.             }
  14.             geometry IndexedFaceSet {
  15.                 coord DEF CubeCoordinates Coordinate {
  16.                     point [
  17.                     # Coordinates around top of cube
  18.                         -1.0  1.0  1.0,
  19.                          1.0  1.0  1.0,
  20.                          1.0  1.0 -1.0,
  21.                         -1.0  1.0 -1.0,
  22.                     # Coordinates around bottom of cube
  23.                         -1.0 -1.0  1.0,
  24.                          1.0 -1.0  1.0,
  25.                          1.0 -1.0 -1.0,
  26.                         -1.0 -1.0 -1.0
  27.                     ]
  28.                 }
  29.                 coordIndex [
  30.                     # top
  31.                     0, 1, 2, 3, -1,
  32.                     # bottom
  33.                     7, 6, 5, 4, -1,
  34.                     # front
  35.                     0, 4, 5, 1, -1,
  36.                     # right
  37.                     1, 5, 6, 2, -1,
  38.                     # back
  39.                     2, 6, 7, 3, -1,
  40.                     # left
  41.                     3, 7, 4, 0
  42.                 ]
  43.             }
  44.         },
  45.     # Animation clock
  46.         DEF Clock TimeSensor {
  47.             cycleInterval 4.0
  48.             loop TRUE
  49.         },
  50.     # Animation morph
  51.         DEF CubeMorph CoordinateInterpolator {
  52.             key [ 0.0, 0.5, 1.0 ]
  53.             keyValue [
  54.             # time 0.0 coordinates (cube)
  55.                 -1.0  1.0  1.0,   1.0  1.0  1.0,
  56.                  1.0  1.0 -1.0,  -1.0  1.0 -1.0,
  57.                 -1.0 -1.0  1.0,   1.0 -1.0  1.0,
  58.                  1.0 -1.0 -1.0,  -1.0 -1.0 -1.0,
  59.             # time 0.5 coordinates (warped cube)
  60.                 -1.5  1.0  1.5,   1.5  1.0  1.5,
  61.                  1.5  1.0 -1.5,  -1.5  1.0 -1.5,
  62.                 -0.5 -1.0  0.5,   0.5 -1.0  0.5,
  63.                  0.5 -1.0 -0.5,  -0.5 -1.0 -0.5,
  64.             # time 1.0 coordinates (cube)
  65.                 -1.0  1.0  1.0,   1.0  1.0  1.0,
  66.                  1.0  1.0 -1.0,  -1.0  1.0 -1.0,
  67.                 -1.0 -1.0  1.0,   1.0 -1.0  1.0,
  68.                  1.0 -1.0 -1.0,  -1.0 -1.0 -1.0
  69.             ]
  70.         }
  71.     ]
  72. }
  73. ROUTE Clock.fraction_changed  TO CubeMorph.set_fraction
  74. ROUTE CubeMorph.value_changed TO CubeCoordinates.set_point
  75.